package com.user.service;

import com.user.dao.UserDao;
import com.user.vo.User;

public class UserServiceImpl implements UserService {

	private UserDao userDao;

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public void createUser(User user) {
		userDao.addUser(user);

	}

	public User getUserById(Integer uId) {
		return userDao.getUserById(uId);
	}

	public Page loadAll(Page page, UserQryHelper helper) {
		page.setTotalRecNum(new Long(userDao.getCountUsers(helper)));
		page.setContent(userDao.loadAll(page.getStartIndex().intValue(), page
				.getPageSize(), helper));
		return page;
	}

	public void modifyUser(User user) {
		userDao.updateUser(user);

	}

	public void removeUser(User user) {
		userDao.deleteUser(user);

	}

}
